package com.xq.kotlin.coroutines

import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.delay
import kotlinx.coroutines.runBlocking
import kotlinx.coroutines.withContext

/**
 * @author jltxseo
 *         Created by junlintianxia on 2019/12/19.
 */

fun main() = runBlocking {
    var image = suspendingGetImage()

    println("" + Thread.currentThread() + "main" + image)

}

private suspend fun suspendingGetImage(): Int = withContext(Dispatchers.IO) {
    println("getImage      : I'm working in thread ${Thread.currentThread().name}")
    delay(5000)
    100
}


